
import os
import sys
import uuid

import django

base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(base_dir)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "zyy_django.settings")
django.setup()

from apps.login.models import UserInfo


def get_token():
    return str(uuid.uuid4())

a = []
for i in range(21):
    a.append(get_token())
# print(a)

all = UserInfo.objects.all()
# print(all.first().id)

id_list = [i.id for i in all]
# print(id_list)

for i in range(5,22):
    v = UserInfo.objects.filter(id=i).update(token=get_token())
    print(v)

# access_token = UserInfo.objects.filter(token=' ') #从数据库中查询到的token
# print(access_token)
# print(access_token.first().id)


